{% macro gen_table(enterprises) %}
    <table id="brand-table"
           class="table table-bordered table-hover table-condensed table-striped">
        <thead>
        <tr>
            <th>企业名称</th>
            <th>手机号</th>
            <th>姓名</th>
            <th>等级</th>
            <th>开通省份</th>
            <th>子账号人数</th>
            <th>派单上限</th>
            <th>已派单数</th>
            <th>剩余派单数量</th>
            <th>抢单数</th>
            <th>开通时间</th>
            <th>过期时间</th>
            <th>备注</th>
            <th>操作</th>
            <th>首页推广</th>
        </tr>
        </thead>
        <tbody>
        {% for each in enterprises %}
            <tr>
                <td>{{ each.enterprise_name }}</td>
                <td>{{ each.user.mobile }}</td>
                <td>{{ each.user.nickname }}</td>
                <td>{{ each.level_display }}</td>
                <td>{{ each.prov_names }}</td>
                <td>{{ each.sub_accounts | length }}</td>
                <td>{{ each.dispatch_limit }}</td>
                <td>{{ each.dispatch_cnt }}</td>
                <td>{{ each.leave_dispatch_cnt }}</td>
                <td>{{ each.partic_success_cnt }}</td>
                <td>{{ each.start_date }}</td>
                <td>{{ each.expired_date }}</td>
                <td>{{ each.remark }}</td>
                <td>
                    <a
                            class="btn btn-xs btn-primary"
                            href="{{ url_for('enterprise_bp.edit_enterprise', enterprise_id=each.id) }}"
                            name="edit"
                            target="_self"
                    >编辑</a>
                </td>
                <td style="white-space: nowrap; overflow: hidden; -o-text-overflow: ellipsis; text-overflow: ellipsis;">
                    <a
                            class="btn btn-xs btn-primary"
                            href="{{ url_for('enterprise_bp.enterprise_homepage_edit', enterprise_id=each.id) }}"
                            name="homepage-edit"
                            target="_self"
                    >基本信息</a>
                    {% if each.homepage %}
                    <a
                            class="btn btn-xs btn-success"
                            href="{{ url_for('enterprise_bp.enterprise_homepage_extend_edit', enterprise_id=each.id) }}"
                            name="homepage-extend-edit"
                            target="_self"
                    >扩展信息</a>
                    {% endif %}
                </td>
            </tr>
        {% endfor %}
        </tbody>
    </table>
{% endmacro %}
